<template>
  <div class="user-index">
    <div class="indexbox">
      <div class="toptext">
        <div class="logo">
          <img src="../assets/images/slice.png"
               alt="">
        </div>

        <el-dropdown class="avatar-container right-menu-item hover-effect"
                     trigger="click">
          <div class="userlo">
            <span>{{userInfo.firstname}}</span>
            <p>
              {{userInfo.name}}
              <i class="el-icon-caret-bottom"></i>
            </p>
          </div>
          <el-dropdown-menu slot="dropdown">
            <router-link :to="show?'/user/profile':'/user/backstageprofile'">
              <el-dropdown-item>个人中心</el-dropdown-item>
            </router-link>

            <el-dropdown-item divided
                              @click.native="logout">
              <span>退出登录</span>
            </el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
      <div class="centext">
        <h1>尊享四大权益 携手共创健康人生</h1>
        <p>Enjoy the four rights and interests to create a healthy life together</p>
        <div class="bottext">
          <p>关于亿康</p>
          <span></span>
        </div>
      </div>
    </div>
    <div class="mainbox">
      <ul>
        <!-- 检测服务 -->
        <li class="powerful">
          <img src="../assets///images/userindex/Slice 8@2x.png"
               alt="">
          <div class="mainful">
            <h3>检测服务</h3>
            <span>以安全、可靠和便捷的方式，为您提供实时的样本状态跟踪和结果查询功能</span>
            <button @click="goback('/check/checkList')">立即查看</button>
          </div>
        </li>
        <!-- 本地 -->
        <li class="locality">
          <img src="../assets///images/userindex/Slice 9@2x.png"
               alt="">
          <div class="mainful">
            <h3>本地化运营</h3>
            <span>QC数据实时预警、降低风险事件发生</span>
            <button @click="goback('/quality/warning')">立即查看</button>
          </div>
        </li>
        <!-- 临床试验 -->
        <li class="clinical">
          <img src="../assets/images/userindex/Slice 10@2x.png"
               alt="">
          <div class="mainful">
            <h3>临床试验</h3>
            <span>临床数据的采集、传输和管理，保证数据真实有效</span>
            <button @click="goto('edc.yikongenomics.com/login?redirect=%2Findex')">立即查看</button>
          </div>
        </li>
        <!-- ceo信箱 -->
        <li class="ceo">
          <img src="../assets/images/userindex/Slice 11@2x.png"
               alt="">
          <div class="mainful">
            <h3>CEO信箱</h3>
            <span>为顾客提供解答疑问、处理投诉、提供产品或服务信息等各种帮助和支持</span>
            <button @click="goback('/operate/message')">立即查看</button>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import store from "@/store/modules/user"
export default {
  name: 'ReproductiveFrontUserindex',

  data () {
    return {
      show: false,
      userInfo: {

      }
    };
  },

  mounted () {
    const { state } = store
    this.userInfo = {
      name: state.name,
      firstname: state.name.split('')[0]
    }
    this.show = state.isRegister
  },

  methods: {
    goback (path) {
      this.$router.push({ path })
    },

    goto (path) {
      window.open('http://' + path);
    },

    async logout () {
      this.$confirm('确定注销并退出系统吗？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$store.dispatch('LogOut').then(() => {
          // location.href = '/index';
          if (this.show) {
            this.$router.push('/userlogin')
          } else {
            this.$router.push('/login')
          }


        })
      }).catch(() => { });
    }
  }

};
</script>

<style lang="scss" scoped>
.user-index {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: #fbfbfb;
  .indexbox {
    width: 100%;
    background: url("../assets/images/userindex/Slice\ 7@2x.png") no-repeat;
    background-size: 100% 100%;
    height: 48%;
    padding-top: 7px;
    box-sizing: border-box;
    .toptext {
      display: flex;
      justify-content: space-between;
      align-items: center;
      box-sizing: border-box;
      padding: 0 28px;

      .logo {
        img {
          width: 132px;
          height: 60px;
        }
      }

      .userlo {
        display: flex;
        align-items: center;
        justify-content: space-around;
        cursor: pointer;
        span {
          display: block;
          width: 32px;
          height: 32px;
          border-radius: 50%;
          background-color: #aa2299;
          font-size: 14px;
          line-height: 32px;
          text-align: center;
          color: #fff;
          margin-right: 10px;
        }

        p {
          font-size: 14px;
          color: #000;
        }
      }
    }

    .centext {
      // position: relative;
      // top: 10px;
      margin-top: 6%;
      // padding: 0px 139px;
      margin-left: 10%;
      box-sizing: border-box;

      h1 {
        width: 871px;
        font-size: 48px;
        font-weight: 800;
        color: #aa2290;
        margin: 0;
      }

      p {
        width: 608px;
        font-size: 16px;
        font-weight: 400;
        color: #aa2290;
      }

      .bottext {
        display: flex;
        align-items: center;
        // margin-top: 82px;

        p {
          width: 100px;
          font-size: 22px;
          font-weight: bold;
          color: #aa2290;
        }

        span {
          display: block;
          width: 187px;
          height: 1px;
          background: #aa2290;
          border-radius: 0px 0px 0px 0px;
          opacity: 1;
        }
      }
    }
  }

  .mainbox {
    box-sizing: border-box;
    // padding: 41px 68px;
    display: flex;
    flex: 1;

    ul {
      width: 100%;
      height: 100%;
      list-style: none;
      display: flex;
      justify-content: space-around;
      align-items: center;
      padding: 0px 68px;
      box-sizing: border-box;
      margin: 0;
      li {
        width: 22%;
        height: calc(100% - 100px);
        background: #ffffff;
        box-shadow: 0px 50px 80px 0px rgba(0, 0, 0, 0.02);
        border-radius: 15px 15px 15px 15px;
        opacity: 1;
        text-align: center;
        // margin-left: 48px;
        // padding-bottom: 30px;

        img {
          width: 100%;
          // height: 146px;
          background-color: #fdecfa;
        }

        .mainful {
          width: 100%;
          display: flex;
          flex-direction: column;
          justify-content: center;
          align-items: center;

          h3 {
            // width: 119px;
            font-size: 27px;
            font-weight: 600;
            color: #aa2290;
            margin: 27px 0 8px 0;
          }

          span {
            display: block;
            // width: 260px;
            height: 64px;
            line-height: 29px;
            font-size: 16px;
            font-weight: 500;
            color: #696984;
            margin-top: 0px;
            padding: 0 15px;
          }

          button {
            width: 184px;
            height: 42px;
            background: #ffffff;
            border: none;
            box-shadow: 0px 10px 60px 0px rgba(38, 45, 118, 0.08);
            border-radius: 10px 10px 10px 10px;
            margin-top: 15px;
            cursor: pointer;
            color: #aa2290;
            font-size: 15px;
          }
        }
      }
      li:first-child {
        margin-left: 0px;
      }
    }
  }
}
</style>
